package com.tecsup.oper.servlet.Pronostico;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tecsup.oper.dao.PronosticoBuscarDAO;
import com.tecsup.oper.modelo.Pronostico;

import excepcion.DAOExcepcion;


@WebServlet("/PronosticoObtenerServlet")
public class PronosticoObtenerServlet extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
	static final long serialVersionUID = 1L;
    
	public PronosticoObtenerServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		String a = request.getParameter("id");
		Integer idp = Integer.parseInt(a);
		
		PronosticoBuscarDAO dao = new PronosticoBuscarDAO();
		try {
			Pronostico vo = dao.obtener(idp);
			request.setAttribute("vo", vo);
		} catch (DAOExcepcion e) {
			System.out.println(e.getMessage());
			RequestDispatcher rd = request.getRequestDispatcher("error.jsp");
			rd.forward(request, response);
		}
		RequestDispatcher rd = request.getRequestDispatcher("ProductoTerminado.jsp");
		rd.forward(request, response);
	
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}
}


